package com.fanshuai.event;

import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * EventListener默认为同步执行，通过@Async异步执行。可以配置全局的线程池优化性能
 */
@Component
public class FanshuaiEventListener2 {

    @EventListener
    @Async
    public void handleEvent(FanshuaiEvent event) {
        System.out.println("receive event by @EventListener, event=" + event.getSource());
    }
}
